export function tabFunctions(activeTabName, listRefs) {
    const handChangeTab = (name) => {
        activeTabName.value = name
    }

    const handClickTab = (tab) => {
        //实时刷新页面数据
        if (listRefs.value[tab.index]) {
            listRefs.value[tab.index].resetQuery()
        }
    }

    const loopSetRef = (index) => {
        return (el) => {
            if (el) {
                // 当组件被挂载时，将其引用添加到数组中
                if (!listRefs.value[index]) {
                    listRefs.value[index] = el
                }
            }
        }
    }

    return {
        handChangeTab,
        handClickTab,
        loopSetRef
    }
}